package com.cyn.controller;

import com.cyn.controller.rabbitmq.HelloSender;
import com.cyn.controller.rabbitmq.config.Order;
import com.cyn.controller.rabbitmq.config.Send;
import com.cyn.controller.rabbitmq.config.Send2;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.UUID;

@Slf4j
@RestController
@RequestMapping("demo")
public class DemoController {

    @Autowired
    private HelloSender helloSender;

    @Autowired
    private Send send;

    @Autowired
    private Send2 send2;

    @Autowired
    RabbitTemplate rabbitTemplate;

    @GetMapping("thtest")
    public Integer thtest() throws Exception {
        Order order = new Order();
        order.setId(1);
        order.setName("OrderName");
        order.setMessageId(System.currentTimeMillis() + "$" + UUID.randomUUID());
        send.SendOrder(order);
        return null;
    }

}